package com.proj.hot.widget;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * 走马灯型TextView
 * 在获得焦点时会循环滚动显示不全的文字
 * 失去焦点时停止滚动，超出框体的部分以省略号显示
 *
 */
public class MarqueeTextView extends TextView
{
	public MarqueeTextView(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}
	
	public MarqueeTextView(Context context)
	{
		super(context);
	}
	
	@Override
	protected void onFocusChanged(boolean focused, int direction,
			Rect previouslyFocusedRect)
	{
		if (focused)
			super.onFocusChanged(focused, direction, previouslyFocusedRect);
	}
	
	@Override
	public void onWindowFocusChanged(boolean hasWindowFocus)
	{
		if (hasWindowFocus)
			super.onWindowFocusChanged(hasWindowFocus);
	}
	
	@Override
	public boolean isFocused()
	{
		return true;
	}
}
